package com.zcc.blog.mapper;

import com.zcc.blog.dto.BlogMonthDto;
import com.zcc.blog.entity.Blog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zcc.blog.untils.Result;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author zcc
 * @since 2022-09-05
 */
@Mapper
public interface BlogMapper extends BaseMapper<Blog> {
    /**
     * 删除或者恢复博客
     * @param status 1 删除 0 恢复
     * @param id
     * @return
     */
    public boolean changeStatus(Integer status, Long id);

    /**
     * 开启自我推荐或者关闭自我推荐博客
     * @param recommend 1 开启 0 关闭
     * @param id
     * @return
     */
    public boolean changeRecommend(Integer recommend, Long id);

    /**
     * 统计每个月的博客发布量
     * @param id
     * @return
     */
    public List<BlogMonthDto> countBlogsByMonth(Long id);

}
